<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>글 상세보기</title>
<script>
	function boardEvent_delete(boardEvent_no){
		if(confirm("삭제할래?")){
			location.href="/web/boardEvent/delete?boardEvent_no="+boardEvent_no;
		}else{
			location.href="/web/boardEvent/detail?boardEvent_no="+boardEvent_no;
		}
	};
	function boardEvent_commentDelete(){
		if(confirm("삭제할래?")){
			document.commentDelete.submit();
		}else{
			document.commentDelete.action="/web/boardEvent/detail";
			commentDelete.submit();
		}
	};
 	function boardEvent_commentInsert(){
		var comment = document.commentInsert;
		if(!comment.boardEvent_user.value){
			alert("로그인이 필요합니다.");
			location.href="/web";
		}else{
			document.commentInsert.submit();
		}
	};
</script>
</head>
<body>
<!-- 상단 로그인 패널을 include로 삽입 -->
<div style="position:absolute; left:50%; top:0px; width:1200px; height:80px; margin-left:-600px;z-index:1 ">
<%@ include file="../loginPanel.jsp" %>
</div>

<!-- 상단 및 좌측 메뉴(카테고리)리스트를 include로 삽입 -->
<div style="position:absolute; left:50%; top:0px; width:1200px; height:80px; margin-left:-600px;">
<%@ include file="../top.jsp" %>
</div>

<div style="position:absolute; left:50%; top:160px; width:1000px; height:80px; margin-left:-400px;">
<!--------------------------------------여기다가 각자 삽입------------------------------------>
	<table style="margin-left:30px; margin-top:30px" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td><img src="/web/resources/images/bar_t_line.gif" border="0" alt="" /></td>
			<td style="color:333333;font-size:14px;font-weight:bold;">후기게시판</td>
		</tr>
	</table>
	<br><br>
<center>
<form action="/web/boardEvent/modifyView" method="post">
	<table width="900px" border="0" cellspacing="0" cellpadding="0" style="margin-top:5px;">
        <tr>
          <td bgcolor="#333333" height="2"></td>
        </tr>
      </table>
      <table width="900px" border="0" cellspacing="0" cellpadding="0" style="margin-top:1;margin-bottom:1">
        <tr>
          <td height="24">
            <table width="900px" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="13%" style="padding:10px 0px 10px 0px; color:#555555; 
                	font-weight:bold; font-size:11px;">작성자</td>
                <td style="padding-left:10px">${beans.boardEvent_name}</td>
                <td width="8%" style="padding:10px 0px 10px 0px; color:#555555; 
                	font-weight:bold; font-size:11px;">등록일</td>
                <td style="padding-left:10px">${beans.boardEvent_date}</td>
				<td width="5%" style="padding:10px 0px 10px 0px; color:#555555; 
                	font-weight:bold; font-size:11px;">조회수</td>
                <td style="padding-left:10px">${beans.boardEvent_count}</td>
              </tr>
              <tr>
                <td style="padding:10px 0px 10px 0px; color:#555555; 
                	font-weight:bold; font-size:11px;">제 목</td>
                <td style="padding-left:10px">${beans.boardEvent_subject}</td>
              </tr>
              <tr>
                <td style="padding-left:10px">${beans.boardEvent_content}</td>
              </tr>
            </table>
          </td>
        </tr>
        </table>
</form>
        <!-- 댓글보기 -->
		<br><br><br><br>
<c:forEach items="${cList }" var="list">
	<form name="commentDelete" action="/web/boardEvent/commentDelete" method="post">
		<input type="hidden" name="boardEvent_no" value="${list.boardEvent_no}">
		<input type="hidden" name="boardEvent_number" value="${list.boardEvent_number }">
        	<table>
				<c:if test="${cList.size()!=0}" >
 					<tr>
 					<c:if test="${list.boardEvent_comment!=null }">
	 					<td style="padding:15px 15px 15px 15px; color:#222222;" width="80px" align="center"> 
 							${list.boardEvent_user}</td>
 						<td width="600px" style="padding:15px 15px 15px 15px; color:#222222;" align="left">
	 						<b>${list.boardEvent_comment}</b></td>
 						<c:if test="${user==null || user!=list.boardEvent_user}">
	 						<td width="200px" style="color:#222222;">
 								${list.boardEvent_date}
 							</td>
						</c:if>
						<c:if test="${user==list.boardEvent_user || user=='admin'}">
							<td width="200px" style="color:#222222;">
 							<input type="image" src="/web/resources/images/icon_del.gif"
							   	onclick="boardEvent_commentDelete()"></td>
						</c:if>
					</c:if>
 					</tr>
 				</c:if>
 			</table>
 	</form>
</c:forEach>
		<br>
		<!-- ======== -->

		<br>
		<table width="900px" border="0" cellspacing="0" cellpadding="0">
        	<tr>
          		<td bgcolor="333333" height="1"></td>
        	</tr>
      </table>
	<!-- 댓글 입력 -->
		<form name="commentInsert" action="/web/boardEvent/commentInsert" method="post">
			<input type="hidden" name="boardEvent_no" value="${beans.boardEvent_no}">
			<input type="hidden" name="boardEvent_user" value="${user}">
				<table width="900px" border="0" cellpadding="0" cellspacing="0">
	  				<tr>
						<td><textarea name="boardEvent_comment" style="width:100%; height:80px; border:1 #999999 solid;"></textarea></td>
						<td width="100" align="center">
							<input type="button" value="댓글입력" style="border:0" onclick="boardEvent_commentInsert()">
							<!-- src="/web/resources/images/btn_comment.gif" --> 
						</td>
	  				</tr>
				</table>
		</form>
		<table width="900px" border="0" cellspacing="0" cellpadding="0">
        	<tr>
          		<td bgcolor="333333" height="1"></td>
        	</tr>
      	</table>
      	<br>
        <table width="900px">
		<tr>

		<!-- 리스트 -->
			<td align="left">
				<input type="image" src="/web/resources/images/btn_list.gif"
				       onclick="location.href='/web/boardEvent/list'">
		<!-- 글쓰기 -->
	<c:if test="${user!=null }">		
				<input type="image" src="/web/resources/images/btn_write.gif"
				       onclick="boardEvent_insert()">
	</c:if>				       
			</td>
	<c:if test="${user!=null && user==beans.boardEvent_name}">			
		<!-- 수정하기 -->
			<td align="right">
				<input type="image" src="/web/resources/images/btn_modify.gif"
					   onclick="location.href='/web/boardEvent/modifyView?boardEvent_no=${beans.boardEvent_no}'">
		<!-- 삭제하기 -->
				<input type="image" src="/web/resources/images/btn_delete.gif"
					   onclick="boardEvent_delete(${beans.boardEvent_no})">
			</td>
	</c:if>			
		</tr>
		</table>
		
	</center>
		<!--------------------------------------   삽입 끝       ------------------------------------>
</div> 

<!-- 하단 이용약관, 고객센터, 회사정보 등의 정보를 include로 삽입 -->
<div style="position:absolute; left:0; top:1200px; width:100%; height:80px; ">
<%@ include file="../bottom.jsp"%>
</div>
</body>
</html>